﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.IO;

namespace _01.HelloNameTest
{
    [TestClass]
    public class HelloNameTest
    {
        [TestMethod]
        public void TestMethodInputName()
        {
            using (StringWriter consoleText = new StringWriter())
            {
                // redirect console output to StringWriter
                Console.SetOut(consoleText);
                
                string name = "Muncho";
                HelloName.PrintHelloName(name);
                string expected = string.Format("Hello, {0}{1}", name, Environment.NewLine);
                Assert.AreEqual(expected, consoleText.ToString());
            }
        }
    }
}
